#ifndef TCP_ACCEPTOR_CONFIG_H
#define TCP_ACCEPTOR_CONFIG_H

#include "io_acceptor_config.h"
#include "tcp_session_config.h"

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
namespace vpm
{
	namespace mina
	{
		using boost::property_tree::ptree;
		static const char * TAO_REUSE_ADDRESS = "ReuseAddress";

		class TcpAcceptorConfig : public IoAcceptorConfig
		{
		public:

			TcpAcceptorConfig()
			{
				m_tcpSessionConfig.reset(new TcpSessionConfig());

				m_tcpAcceptorOptions.put(TAO_REUSE_ADDRESS,true);				
			}

			TcpSessionConfigPtr & get_session_config()
			{
				return m_tcpSessionConfig; 
			}

			bool is_reuse_address()
			{
				return m_tcpAcceptorOptions.get<bool>(TAO_REUSE_ADDRESS);
			}

			void set_reuse_address(bool flag)
			{
				m_tcpAcceptorOptions.put(TAO_REUSE_ADDRESS,flag);
			}

		private:
			TcpSessionConfigPtr m_tcpSessionConfig; 			
			ptree m_tcpAcceptorOptions;
		};
		typedef boost::shared_ptr<TcpAcceptorConfig> TcpAcceptorConfigPtr; 
	}
}

#endif // 

  

